package com.yan.service.page;

import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.apache.ibatis.plugin.Interceptor;

public class Plugin {

	/**
	 * 分页插件
	 */
	public static Interceptor pageInterceptor() {
		PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
		paginationInterceptor.setDialectType("mysql");
		return paginationInterceptor;
	}

	/**
	 * plus 全局配置
	 */
	public static GlobalConfig globalConfig() {
		GlobalConfig globalConfig = new GlobalConfig();
		return globalConfig.setMetaObjectHandler(new MetaHandler()).setSqlInjector(new DefaultSqlInjector());
	}

}
